<template>
  <div>
    <!-- :class="!item1.children || item1.children.length == 0 ? 'no-arrow' : null" -->
    <van-collapse-item
      v-for="(item1, index1) in datas"
      :key="index1"
      :name="item1.id"
    >
      <template #title>
        <div>{{ item1.chapterName }}</div>
      </template>
      <chapter-ware-tree
        v-if="item1.children && item1.children.length > 0"
        :datas="item1.children"
      ></chapter-ware-tree>
      <div v-if="!item1.children || item1.children.length == 0">
        {{ $t("locale.components.mobile.ChapterWareTree.t1") }}：<a
          :href="item1.courseWarePath"
          :download="item1.chapterName"
          >{{ $t("locale.components.mobile.ChapterWareTree.t2") }}</a
        >
      </div>
    </van-collapse-item>
  </div>
</template>

<script>
export default {
  name: "ChapterWareTree",
  props: ["datas"],
  components: {},
  data() {
    return {};
  },
  computed: {},
  watch: {},
  methods: {
    pushRouter(item) {
      if (item.children && item.children.length > 0) {
        return;
      }
      this.$router.replace({
        path: "",
        query: {
          chapterId: item.id
        }
      });
    }
  },
  created() {},
  mounted() {}
};
</script>

<style lang="sass" scoped></style>
